<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class DriverCar extends Model
{
    protected $table = 'driver_car';

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     * 关联车辆信息
     */
    public function car()
    {
        return $this->hasOne(Car::class, 'id', 'car_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     * 关联司机
     */
    public function drivers()
    {
        return $this->hasOne(Drivers::class, 'id', 'driver_id');
    }

    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }

}
